import { ITEM_INFO, ITEM_SEARCH, ITEM_SEARCH_HOT, ITEM_RECOMMEND } from '@constants/item'
import { API_ITEM, API_ITEM_SEARCH, API_ITEM_SEARCH_HOT, API_ITEM_RECOMMEND } from '@constants/api'
import { createAction } from '@utils/redux'

/**
 * 商品详情
 * @param {*} payload
 */
export const dispatchItem = payload => createAction({
  url: API_ITEM,
  type: ITEM_INFO,
  payload
})

/**
 * 商品搜索
 * @param {*} payload
 */
export const dispatchItemSearch = payload => createAction({
  url: API_ITEM_SEARCH,
  type: ITEM_SEARCH,
  payload
})

/**
 * 商品热门搜索
 * @param {*} payload
 */
export const dispatchItemSearchHot = payload => createAction({
  url: API_ITEM_SEARCH_HOT,
  type: ITEM_SEARCH_HOT,
  payload
})

/**
 * 商品推荐，猜你喜欢
 * @param {*} payload
 */
export const dispatchItemRecommend = payload => createAction({
  url: API_ITEM_RECOMMEND,
  type: ITEM_RECOMMEND,
  payload
})
